// import { login, logout, getInfo } from '@/api/user'
import { getToken, setToken, removeToken } from '@/utils/auth'
// import { resetRouter } from '@/router'

const getDefaultState = () => {
  return {
    token: getToken(),
    navStatus: false
  }
}
const state = getDefaultState()

const mutations = {
  RESET_STATE: (state) => {
    Object.assign(state, getDefaultState())
  },

  // 存储token
  SET_TOKEN: (state, token) => {
    state.token = token
    setToken(token)
  },
  // 删除token
  REMOVE_TOKEN: (state, token) => {
    state.token = null
    removeToken(token)
  },
  // 更改  头部导航的状态
  SET_NAV_STATUS: (state, status) => {
    state.navStatus = status
  }
}
const actions = {
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

